package ${package.ServiceImpl};

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import UUIDUtil;
import QueryWrapperUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
*
*  ${entity} 服务实现类
*
* @author ${author}
* @date ${date}
*/
@Service
<#if kotlin>
    open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
    }
<#else>
    public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
    @Resource
    private ${table.mapperName}  ${table.mapperName?lower_case};

    /**
    * ${table.comment!}根据map条件列表(分页)
    * @param map 查询条件
    * @param ordName 排序字段
    * @param notNullColumn 不为空字段
    * @return  IPage<${entity}>
    */
    @Override
    public IPage<${entity}> pageList(IPage<${entity}> page,Map< String,Object > map,String ordName, String notNullColumn) {
    return ${table.mapperName?lower_case}.selectPage(page, QueryWrapperUtils.queryWrapper(map, ordName, notNullColumn));
    }

    /**
    * ${table.comment!}根据map条件列表
    * @param map 查询条件
    * @param ordName 排序字段
    * @param notNullColumn 不为空字段
    * @return  List<${entity}>
    */
    @Override
    public List<${entity}> allList(Map< String,Object > map,String ordName, String notNullColumn){
    return ${table.mapperName?lower_case}.selectList(QueryWrapperUtils.queryWrapper(map, ordName, notNullColumn));
    }

    /**
    * ${table.comment!}插入一条记录
    * @param entity 实体对象
    * @return  影响条数
    */
    @Override
    public int insertOne(${entity} entity){
    return ${table.mapperName?lower_case}.insert(entity);
    }
    /**
    * ${table.comment!}更新一条记录
    * @param entity 实体对象
    * @return  影响条数
    */
    @Override
    public int updateOne(${entity} entity){
    return ${table.mapperName?lower_case}.updateById(entity);
    }
    /**
    * ${table.comment!}更删除一条记录
    * @param uuid uuid
    * @return  影响条数
    */
    @Override
    public int deleteOne(String uuid){
    return ${table.mapperName?lower_case}.deleteById(uuid);
    }
  }
</#if>